package com.smfx.yxt.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.smfx.yxt.daoSqlserver.StudentRoutineParamMapper;
import com.smfx.yxt.model.StudentRoutineParam;
import com.smfx.yxt.reqVo.BaseQueryVO;
import com.smfx.yxt.service.IStudentRoutineParamService;

@Service("studentRoutineParamService")
public class StudentRoutineParamServiceImpl implements IStudentRoutineParamService {

	@Autowired
	private StudentRoutineParamMapper studentRoutineParamMapper;
	
	@Override
	public List<StudentRoutineParam> selectList(BaseQueryVO vo) {
		return studentRoutineParamMapper.selectList(vo);
	}

	@Override
	public List<StudentRoutineParam> selectByTeacherId(Integer teacherId) {
		return studentRoutineParamMapper.selectByTeacherId(teacherId);
	}

	@Override
	public boolean isJudgeTeacher(Integer teacherId) {
		return studentRoutineParamMapper.selectCountByTeacherId(teacherId) > 0 ? true : false;
	}

	@Override
	public StudentRoutineParam selectById(Integer id) {
		return studentRoutineParamMapper.selectByPrimaryKey(id);
	}

	@Override
	public int addUpdate(StudentRoutineParam record) {
		if(record.getId() != null) {
			record.setUpdateTime(new Date());
			return studentRoutineParamMapper.updateByPrimaryKeySelective(record);
		}
		return studentRoutineParamMapper.insertSelective(record);
	}

}
